package Iterator;

import java.util.LinkedList;
import java.util.List;

public class MyList {
    List<Integer>myList=new LinkedList<>();

    public Iterator iterator()
    {
        return new Iterator();
    }

    public class Iterator
    {
        private int index=0;
        public boolean hasNext()
        {
            return index<myList.size();
        }

        public Integer next()
        {
            return myList.get(index++);
        }
    }
}
